/*----------------------------------------------------------------------------*\
| /gamemode/cl_init.lua                | base client file                | CLI |
\*----------------------------------------------------------------------------*/

include("enum.lua")
include("config.lua")
include("shared.lua")

include("cl_chat.lua")
include("cl_deaths.lua")
include("cl_etc.lua")
include("cl_fatigue.lua")
include("cl_goals.lua")
include("cl_hud.lua")
include("cl_inventory.lua")
include("cl_notices.lua")
include("cl_player.lua")
include("cl_postprocess.lua")
include("cl_ragdolls.lua")
//include("cl_scoreboard.lua")
include("cl_sniping.lua")
include("cl_time.lua")
include("cl_wswitch.lua")

surface.CreateFont("Tahoma",24,400,true,false,"ZDTip")
surface.CreateFont("Tahoma",14,800,true,false,"ZDChat")
surface.CreateFont("Tahoma",18,800,true,false,"ZDTargetID")
surface.CreateFont("Tahoma",32,500,true,false,"CellHeader")
surface.CreateFont("Tahoma",24,500,true,false,"CellMed")
surface.CreateFont("Tahoma",18,800,true,false,"CellMain")

function GM:Initialize()
	wswitch.CurWeapon = 4
end
function FlashlightBind( ply, bind, pressed )
	if not pressed then return false end
	if (bind == "impulse 100") then
		if (wswitch.MyWeapons[2]) then
			if (!ply:Alive() or ply:IsRagdolled()) then return true end
			if (LocalPlayer():GetActiveWeapon():GetClass() != "weapon_flashlight") then
				wswitch.CurWeapon=2
				LocalPlayer():ConCommand("selectweapon weapon_flashlight \n")
				LocalPlayer():ConCommand("-attack\n")
				wswitch.Switch=false
				wswitch.Toggle=false
				return true
			else
				return true
			end
		else
			return true
		end
	end
end
hook.Add( "PlayerBindPress", "SWEP FlashlightBind", FlashlightBind )